package com.netty.rpc.controller;

import com.netty.rpc.annotation.RpcReference;
import com.netty.rpc.client.RpcClient;

import com.netty.rpc.resp.Response;
import com.netty.rpc.service.CalcService;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@RequestMapping("/calc")
public class CalcController {

    @RpcReference
    private CalcService calcService;

    /*@RequestMapping("/add")
    public Response add(Integer a, Integer b){
        return new RpcClient().refer(CalcService.class).add(1,2);
    }*/

    @RequestMapping("/netty/add")
    public Response nettyAdd(Integer a, Integer b){
        return calcService.add(a, b);
    }

}
